package main

import (
	"api/common/orm"
	"fmt"
	"strings"
	"time"
)

func main() {
	dateFmt := "2006-01-02"
	now := time.Now()
	year := orm.ToStr(now.Year())
	value := "07-01,08-31"
	valueData := strings.Split(value, ",")
	beginDate := year + "-" + valueData[0]
	endDate := year + "-" + valueData[1]
	d0, _ := time.Parse(dateFmt, beginDate)
	d1, _ := time.Parse(dateFmt, endDate)
	isBetween := now.After(d0) && now.Before(d1)
	fmt.Println(now.Format(dateFmt), beginDate, endDate, isBetween)
	if !isBetween {
		errMsg := "报名日期是从%d月%d日到%d月%d日，请知悉。"
		errMsg = fmt.Sprintf(errMsg, d0.Month(), d0.Day(), d1.Month(), d1.Day())
		fmt.Println(errMsg)
	}
}
